import { createStore, applyMiddleware } from "../kredux/index";
// import { createStore, applyMiddleware } from "redux";
import logger from "redux-logger";
import thunk from "redux-thunk" 


// 初始化数据
const initialState = {
      count: 1
};

// 建立修改规则
const reducer = (state = initialState, { type, payload = 1 }) => {
      switch (type) {
            case "ADD":
                  state.count = state.count + payload;
                  return { ...state };

            default:
                  return state;
      }
};

const store = createStore(reducer, applyMiddleware(thunk, logger));
export default store;
